const Sequelize = require('sequelize')
const sequelize = require('../config/index')
const User = require('./user').User
let User_preferences = sequelize.define('user_preferences',{
    id:{
        type:Sequelize.INTEGER,
        primaryKey: true,
        autoIncrement: true,
        comment:'id',
    },

        available_time:{
        type:Sequelize.STRING,
        defaultValue:'周末',
        comment:'可工作时间',
    },
    status:{
        type:Sequelize.STRING,
        defaultValue:'在校',
        comment:'目前状态 在校 ....',
    },
    skill:{
        type:Sequelize.STRING,
        defaultValue:'',
        comment:'技能方向 艺术设计 '
    },
    partytime_desire:{
        type:Sequelize.STRING,
        defaultValue:0,
        comment:'兼职意愿'
    }
},{
    // freezeTabelName 为 true 时不会在库中映射表时增加复数表名
    // 该选项为 true 时，user 在映射时映射成 user，而为 false 时会映射成users
    freezeTableName: true,
})
User_preferences.belongsTo(User,{foreignKey: "uid"});
// Skill.belongsToMany(User, {through : 'userSkill'});
//这会创建一个新模型UserProject,其中projectId和userId两个外键。定义through选项后，Sequelize会尝试自动生成名字。
//在本例中，会为User添加方法getUsers,setUsers,addUser,addUsers到Project中。getProjects,setProjects,addProject,addProjects到User中.


let user_preferences = User_preferences.sync();

module.exports = User_preferences

